﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using RechercheEmplois.Models;
using WebGrease.Css.Extensions;

namespace RechercheEmplois.Controllers
{
    public class HomeController : Controller
    {
        private ApplicationDbContext db = new ApplicationDbContext();
        public ActionResult Index()
        {
            #region Rechercher Rapidement Dialog
                var listProvines = new List<SelectListItem>();
                db.Provines.ForEach(p =>
                {
                    listProvines.Add(new SelectListItem() { Selected = false, Text = p.Libelle, Value = p.ID.ToString() });
                });
                ViewBag.Provines = listProvines;
                var listDomaines = new List<SelectListItem>();
                db.Domaines.ForEach(p =>
                {
                    listDomaines.Add(new SelectListItem() { Selected = false, Text = p.Libelle, Value = p.ID.ToString() });
                });
                ViewBag.Domaines = listDomaines;
                var listTypes = new List<SelectListItem>();
                Enum.GetValues(typeof(OffreType)).Cast<OffreType>().ForEach(p => listTypes.Add(new SelectListItem() { Selected = false, Text = p.ToString(), Value = p.ToString() }));
                ViewBag.OffreTypes = listTypes;
            #endregion
            return View();
        }

        public ActionResult About()
        {
            ViewBag.Message = "Your application description page.";

            return View();
        }

        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";

            return View();
        }
    }
}